<template>
    <div>
        <p style="font-size:30px;margin-bottom:30px;margin-top:10px;text-align: center;color:#E6A23C">子父组件之间相互通信</p>
        <div>
        <h3>parent组件部分</h3>
        <input type="text" v-model="parentMsg">
        </div>
        <child :message="parentMsg" @listenToChildEvent="showMsgFromChild"></child>
    </div>
</template>
<script>
import child from '../subcomponents/testContact.vue'
export default {
        data(){
        return{
            parentMsg:'parentMsg'
        }
    },   
    methods:{
        showMsgFromChild:function(data){
            this.parentMsg = null
            this.parentMsg = data
            data = null
        }   
    },
    components:{
        child
    }

}
</script>

<style lang="sass" scoped>
</style>